package dongtaidaili;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class MyProxy implements InvocationHandler {
	private Object target;
	public MyProxy(Object tar){
		this.target=tar;
	}
	public Object invoke(Object proxy,Method method, Object[] args)
			throws Throwable {
		Cooker.cooker();
		Object res=method.invoke(target, args);
		Waiter.wish();
		return res;
	}
	public Object getProxy(){
		return Proxy.newProxyInstance(target.getClass().getClassLoader(), target.getClass().getInterfaces(),this);
	}

}
